<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script type="text/javascript">
        function onsubmitFun() {
            alert("静态输入有误---提交失败");

            return false;
        }

        window.onload = function () {
            var submit = document.getElementById("onsubmi01");
            submit.onsubmit = function () {
                alert("动态输入有误---提交失败");

                return false;
            }
        }
    </script>
</head>
<body>
    <form action="http://localhost:8080" method="get" onsubmit="return onsubmitFun()">
        表单1<input type="submit" value="提交表单">
    </form>
    <form action="http://localhost:8080" method="get" id="onsubmi01">
        表单2<input type="submit" value="提交表单">
    </form>
</body>
</html>